<?php
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/logic/CustomCommand.php';	
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/model/factory/DaoFactory.php';
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/logic/factory/CommandFactory.php';
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/model/entity/Pay.php';

	
	error_reporting (E_ALL ^ E_NOTICE);
	
	$debug = $_SESSION['debug'];
	
	/*
	* Command to create pay Publicity
	*/
	class CommandCreatePayPublicity extends CustomCommand {
		/*
		* Constructor of the class
		*/
		public function __construct($namePublicity, $amountPublicity, $numberPublicity, 
			$publicityDate) {
			
			/**
			 * Creating pay Publicity
			 */
			$this -> pay = new Pay($namePublicity, $amountPublicity, $numberPublicity, 
			$publicityDate);
				
			
		}
		
		/*
		* Method to execute to create pay Publicity
		*/
		public function execute() {
			
			
			/**
			 * Creating a pay Publicity
			 */
			$daoFactory = DaoFactory :: getMySqlDaoFactory();
			$ibad = $daoFactory -> getMySqlPayAccessDao();
			$GLOBALS['debug']->log("consiguio el Dao ");
			$payPublicityCreation = $ibad -> createPayPublicity($this -> pay);
			$GLOBALS['debug']->log("ejecuto el Dao ");
		    $GLOBALS['debug']->log("resultado del query: ".$payPublicityCreation);
			$this -> result = $payPublicityCreation;
			
		}
	}
?>